/*
package api;

import model.BlogDao;
import model.User;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

*
 * @Author：徐志荣
 * @Date：2023/6/1 上午 11:40



@WebServlet("delete")
public class deleteServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        HttpSession httpSession = req.getSession(false);
        if(httpSession == null){
            resp.setContentType("text/html;charset=utf8");
            resp.getWriter().write("当前未登录,无法删除博客");
            return;
        }
        User user = (User) httpSession.getAttribute("user");
        if(user == null){
            resp.setContentType("text/html;charset=utf8");
            resp.getWriter().write("当前未登录,无法删除博客");
            return;
        }
        String blogId = req.getParameter("blogId");
        BlogDao blogDao = new BlogDao();
        blogDao.delete(Integer.parseInt(blogId));

        resp.sendRedirect("blog_list.html");

    }
}
*/
